import numpy as np
import torch
import torch.utils.data as d
from parameters import *
import matplotlib.pyplot as plt


def data_generator():
    x = np.random.uniform(-1, 1, [2, n])
    label = []
    for i in range(0, n):
        if A * x[0][i] + B * x[1][i] + C > 0:
            label.append(1)
        else:
            label.append(-1)
    data_x, data_y = x, label
    tensor_x = torch.tensor(data_x, dtype=torch.float).t()
    tensor_y = torch.tensor(data_y, dtype=torch.float)
    data_set = d.TensorDataset(tensor_x, tensor_y)
    loader = d.DataLoader(dataset=data_set, shuffle=True)
    return loader, data_x, data_y


# data_generator()
